<template>
	<view style="height: 100%;">
		<view class="orderForm_content" style="padding-top: 1rpx;padding-bottom: 20rpx;">
			<view class="orderForm_content_item" v-for="(res,index) in list" :key="index"
				@click="skip(`/pages/orderForm/details?id=${res.id}`)">
				<view class="orderForm_content_item_1">
					<text>来源：{{res.device.device_name || res.origin}}</text>
					<text>{{res.status_text}}</text>
				</view>
				<view class="detail">
					<view class="flex">
						<view class="w-60">订单号：{{res.order.order_sn || res.order.order_num}}</view>
						<view class="w-40">当前排名：<text class="color-1">{{res.rank}}</text></view>
					</view>
					<view class="flex" style="margin: 30rpx 0;">
						<view class="w-60">返现金额：¥ {{res.rebate_money}}</view>
						<view class="w-40">已返金额：<text class="color-1">¥ {{res.done_rebate_money}}</text></view>
					</view>
					<view>支付时间：{{res.order.paytime || $u.timeFormat(res.order.pay_time, 'yyyy-mm-dd')}}</view>
				</view>
			</view>
			<u-loadmore v-if="list.length" marginTop="20" :status="loadStatus" @loadmore="scrolltolower"
				margin-top="50" />
		</view>
		<view class="flex flex-jc-c flex-ai-c" v-if="!list.length" style="height: 70%">
			<u-empty text="数据为空" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'orderList',
		props: {
			list: {
				type: Array,
				default: () => []
			},
			loadStatus: {
				type: String,
				default: ''
			},
			type: {
				type: [String,Number],
				default: null
			}
		},
		data() {
			return {
			}
		},
		
		filters: {
			filterStatus(v) {
				let text = ''
				switch (v) {
					case 1:
						text = '待出货'
						break
					case 2:
						text = '已出货,'
						break
					case 3:
						text = '退款中'
						break
					case 4:
						text = '退款失败'
						break
					case 5:
						text = '退款成功'
						break
				}
				return text
			},
			filterAuth(v) {
				let text = ''
				switch (v) {
					case 0:
						text = '待支付'
						break
					case 1:
						text = '待出货'
						break
					case 2:
						text = '售后'
					case 3:
						text = '完成'
						break
					case 4:
						text = '已取消'
						break
				}
				return text
			}
		},
		methods: {
			scrolltolower(){
				this.$emit('scrolltolower')
			},
			skip(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.color-1{
		color: #F95533;
	}
	.w-40{
		width: 40%;
	}
	.w-60{
		width: 60%;
	}
	.orderForm_content {
		.detail{
			font-size: 24rpx;
		}
		&_item {
			background-color: #fff;
			margin-top: 20rpx;
			box-sizing: border-box;
			padding: 30rpx 24rpx;
			position: relative;
	
			&_1 {
				display: flex;
				justify-content: space-between;
				align-items: center;
				box-sizing: border-box;
				padding: 0 25rpx;
				padding-bottom: 30rpx;
				border-bottom: 1px solid #D8D8D8;
				margin-bottom: 24rpx;
	
	
				&>text:nth-child(1) {
					font-size: 28rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #333333;
				}
	
				&>text:nth-child(2) {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
				}
			}
		}
	}
</style>